package com.jsgt.greekfire

import android.app.Activity
import android.app.Application
import android.os.Bundle
import com.fhx.core.utils.LogUtils

class ActivityLifecycleLis : Application.ActivityLifecycleCallbacks {
    var activityCount = 0
    override fun onActivityPaused(activity: Activity) {
    }

    override fun onActivityStarted(activity: Activity) {
        if(activityCount == 0){
            LogUtils.debug("回到前台")
        }
        activityCount++
    }

    override fun onActivityDestroyed(activity: Activity) {
    }

    override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {
    }

    override fun onActivityStopped(activity: Activity) {
        activityCount--
        if(activityCount == 0){
            LogUtils.debug("去到后台")
        }
    }

    override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {
    }

    override fun onActivityResumed(activity: Activity) {
    }

}



